//package service.test;
//import Java.util.List;
//
//import org.apache.commons.httpclient.Credentials;
//import org.apache.commons.httpclient.HttpClient;
//import org.apache.commons.httpclient.auth.AuthScope;
//import org.ow2.bonita.facade.identity.User;
//
// 
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.FileSystemXmlApplicationContext;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.web.client.RestTemplate;
//
//public class UserRestClient {
//    
//    private  RestTemplate restTemplate;
//    private  Credentials credentials;
//    private  String  hostIp;
//    private  int    port;
//    
//    public UserRestClient(RestTemplate restTemplate, Credentials credentials){
//        this.restTemplate = restTemplate;
//        this.credentials = credentials;
//        CommonsClientHttpRequestFactory factory = (CommonsClientHttpRequestFactory) restTemplate.getRequestFactory();
//        HttpClient client = factory.getHttpClient();
//        client.getState().setCredentials(AuthScope.ANY, credentials);
//    }
//    public RestTemplate getRestTemplate() {
//        return restTemplate;
//    }
//
//    public void setRestTemplate(RestTemplate restTemplate) {
//        this.restTemplate = restTemplate;
//    }
//
//    public Credentials getCredentials() {
//        return credentials;
//    }
//
//    public void setCredentials(Credentials credentials) {
//        this.credentials = credentials;
//    }
//
//    public String getHostIp() {
//        return hostIp;
//    }
//
//    public void setHostIp(String hostIp) {
//        this.hostIp = hostIp;
//    }
//
//    public int getPort() {
//        return port;
//    }
//
//    public void setPort(int port) {
//        this.port = port;
//    }
//
//    
//    public List<User>    getAllBonitUser(){
//        MultiValueMap<String, String> map1 = new LinkedMultiValueMap<String, String>();
//        map1.add("options", "user:admin");
//        String url = "http://"+hostIp+":"+port + "/bonita-server-rest/API/identityAPI/getAllUsers";
//        List<User> list =  restTemplate.postForObject(url, map1, List.class);
//        return list;
//    }
//
//}
//
// 
//
// 
//
//public class Client {
//
//    /**
//     * @param args
//     */
//    public static void main(String[] args) {
// 
//        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("//scionDevTool/eclipse3.6/workspace/project-   deploy-portlet/project-deploy-web/src/main/webapp/WEB-INF/spring-applicationContext-projectDeploy.xml");
//         
//         UserRestClient userRestClient = applicationContext.getBean("userRestClient", UserRestClient.class);
//         userRestClient.setPort(8080);
//         userRestClient.setHostIp("172.25.165.66");
//         System.out.println( userRestClient.getAllBonitUser().size());
//
//  }
//
//}